package com.morehair.config;

import com.morehair.utils.StringUtil;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;

/**
 * Author  kkw
 * Date  2021/6/5 15:38
 * Version 1.0
 * Description :
 */

public class CustomSessionManger extends DefaultWebSessionManager {
    @Override
    protected Serializable getSessionId(ServletRequest request, ServletResponse response) {
        HttpServletRequest req= (HttpServletRequest) request;
        String header1= req.getHeader("X-cskaoyan-mall-Admin-Token");
//        String header1= req.getHeader("X-Litemall-Admin-Token");
        if (!StringUtil.isEmpty(header1)) {
            return header1;
        }
        /*String header2= req.getHeader("X-Litemall-Token");
        if (!StringUtil.isEmpty(header2)) {
            return header2;
        }*/
        return super.getSessionId(request, response);
    }
}
